﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="DocumentManagement.Views.BaseView" %>

<%@ Import Namespace="DocumentManagement.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        创建预估单</h2>
    <div>
    <script language="javascript" type="text/javascript">
        function GetYGDSearchUrl()
        {
            var ygbh = "";//document.getElementById("ygbh").value;
            var wtly = document.getElementById("wtly").value;
            var wtf = document.getElementById("wtf").value;
            var xmzl = document.getElementById("xmzl").value;
            var gjshd = document.getElementById("gjshd").value;
            var wtr = document.getElementById("wtr").value;

            return "/YuGuDan.x/Search?" + "ygbh=" + ygbh + "&" + "wtly=" + wtly + "&" + "wtf=" + wtf + "&" + "xmzl=" + xmzl + "&" + "gjshd=" + gjshd + "&wtr=" + wtr;
        }
        
        function GetBGSearchUrl()
        {
            var ygbh = "";//document.getElementById("ygbh").value;
            var wtly = document.getElementById("wtly").value;
            var wtf = document.getElementById("wtf").value;
            var xmzl = document.getElementById("xmzl").value;
            var gjshd = document.getElementById("gjshd").value;
            
            return "/BaoGao.x/Search?" + "ygbh=" + ygbh + "&"  + "wtly=" + wtly + "&" + "wtf=" + wtf + "&" + "xmzl=" + xmzl + "&" + "gjshd=" + gjshd;
        }        
        
        function UpdateSearch()
        {
            var ygdurl = GetYGDSearchUrl();
            var bgurl = GetBGSearchUrl();
            
            document.getElementById("ygdsearchresult").src = ygdurl;
            document.getElementById("bgsearchresult").src = bgurl;
        }

        function CalculatePrice() {

            var jzhmj = document.getElementById("jzhmj").value;
            var ygdj = document.getElementById("ygdj").value;
            var ygzj = document.getElementById("ygzj");

            if (jzhmj != "" && ygdj != "") {
                var v1 = parseFloat(jzhmj);
                var v2 = parseFloat(ygdj);

                if (v1 && v2) {
                    var z = v1 * v2;

                    ygzj.value = z.toFixed(2);
                }            
            }
        
        }
    </script>
        <%using (this.Html.BeginForm("CreateYuGuDan", "yugudan", FormMethod.Post))
          { %>
        <table>
            <tr>
                <td>
                    <div>
                        <label for="">
                            预估编号</label><input type="text" name="ygbh" id="ygbh" onchange="javascript:UpdateSearch()"/>
                    </div>
                    <div>
                        <label for="">
                            委托方</label><input type="text" name="wtf" id="wtf" onchange="javascript:UpdateSearch()"/>
                    </div>
                    <div>
                        <label for="">
                            项目座落</label><input type="text" name="xmzl" id="xmzl" onchange="javascript:UpdateSearch()"/>
                    </div>
                    <div>
                        <label for="">
                            建筑面积</label><input type="text" name="jzhmj" id="jzhmj" onchange="javascript:CalculatePrice()" />
                    </div>
                    <div>
                        <label for="">
                            土地面积</label><input type="text" name="tdmj" />
                    </div>
                    <div>
                        <label for="">
                            业态</label>
                        <%=this.Html.DropDownList("yt", new SelectListItem[] {
                      new SelectListItem() { Text = Utility.GetEnumText(YeTai.ZhuZhai), Value=((int)YeTai.ZhuZhai).ToString()},
                      new SelectListItem() { Text = Utility.GetEnumText(YeTai.GongYe), Value=((int)YeTai.GongYe).ToString()},
                      new SelectListItem() { Text = Utility.GetEnumText(YeTai.ShangYe), Value=((int)YeTai.ShangYe).ToString()},
                      new SelectListItem() { Text = Utility.GetEnumText(YeTai.BanGong), Value=((int)YeTai.BanGong).ToString()},
                      new SelectListItem() { Text = Utility.GetEnumText(YeTai.QiTa), Value=((int)YeTai.QiTa).ToString()}
                  })
                        %>
                    </div>
                    <div>
                        <label for="">
                            竣工日期</label><input type="text" name="jgrq" />
                    </div>
                </td>
                <td>
                    <div>
                        <label for="">
                            建筑层高</label><input type="text" name="jzhcg"  />
                    </div>
                    <div>
                        <label for="">
                            预估单价</label><input type="text" name="ygdj" id="ygdj" onchange="javascript:CalculatePrice()" />
                    </div>
                    <div>
                        <label for="">
                            预估总价</label><input type="text" name="ygzj" id="ygzj" />
                    </div>
                    <div>
                        <label for="">
                            预估净值</label><input type="text" name="ygjzh" />
                    </div>
                    <div>
                        <label for="">
                            项目区域</label><input type="text" name="xmqy" />
                    </div>
                    <div>
                        <label for="">
                            估价时点</label><input type="text" name="gjshd" id="gjshd" onchange="javascript:UpdateSearch()"/>
                    </div>
                    <div>
                        <label for="">
                            环线位置</label>
                        <%=this.Html.DropDownList("hxqy", new SelectListItem[] {
                      new SelectListItem() { Text = Utility.GetEnumText(HuanXianQuYu.NeiHuan), Value=((int)HuanXianQuYu.NeiHuan).ToString()},
                      new SelectListItem() { Text = Utility.GetEnumText(HuanXianQuYu.NeiZhong), Value=((int)HuanXianQuYu.NeiZhong).ToString()},
                      new SelectListItem() { Text = Utility.GetEnumText(HuanXianQuYu.ZhongWai), Value=((int)HuanXianQuYu.ZhongWai).ToString()},
                      new SelectListItem() { Text = Utility.GetEnumText(HuanXianQuYu.Wai), Value=((int)HuanXianQuYu.Wai).ToString()}
                  })
                        %>
                    </div>
                    <div>
                        <label for="">
                            委托来源</label><input type="text" name="wtly" id="wtly" onchange="javascript:UpdateSearch()" />
                    </div>
                    <div>
                        <label for="">
                            经办人</label><input type="text" name="wtr" id="wtr" onchange="javascript:UpdateSearch()" />
                    </div>
                    <div>
                        <label for="">
                            备注：</label><textarea name="bzh" id="bzh"></textarea>
                    </div>
                    <div>
                        <input type="checkbox" name="zjgd" value="true" checked="checked" /><label>直接归档</label>
                    </div>
                </td>
            </tr>
        </table>
        <div>
            <input type="submit" value="创建" />
            <input type="button" value="搜索" onclick="javascript:UpdateSearch()"/>
        </div>
        <div>
                <iframe src="" width="100%" height="500px" id="ygdsearchresult"></iframe>
                <iframe src="" width="100%" height="500px" id="bgsearchresult"></iframe>
        </div>
        <%} %>
    </div>
</asp:Content>
